package com.ruoyi.law.service;


import cn.felord.payment.wechat.v3.WechatResponseEntity;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ruoyi.law.domain.dto.LawOrderDTO;
import com.ruoyi.law.domain.entity.LawOrder;
import com.ruoyi.law.domain.query.LawOtherOrderQuery;
import com.ruoyi.law.domain.query.LawVipOrderQuery;

import java.math.BigDecimal;
import java.util.Map;

/**
 * <p>
 * 律师订单 服务类
 * </p>
 *
 * @author code
 * @since 2022-11-27
 */
public interface ILawOrderService extends IService<LawOrder> {

    /**
     * 生成订单
     *
     * @param vipOrderQuery vip订单查询
     * @return {@link WechatResponseEntity}<{@link ObjectNode}>
     */
    WechatResponseEntity<ObjectNode> generateVipOrder(LawVipOrderQuery vipOrderQuery);

    /**
     * 生成其他订单(咨询和服务)
     *
     * @param otherOrderQuery 其他订单查询
     * @return {@link WechatResponseEntity}<{@link ObjectNode}>
     */
    WechatResponseEntity<ObjectNode> generateOtherOrder(LawOtherOrderQuery otherOrderQuery);

    /**
     * 根据订单号查询订单
     *
     * @param orderNum 订单num
     * @return {@link LawOrder}
     */
    LawOrder getByOrderNum(String orderNum);

    /**
     * 更新订单
     *
     * @param order 订单
     */
    void updateOrder(LawOrder order);

    /**
     * 我的分页
     *
     * @param toPage      分页参数
     * @param lawOrderDTO 查询参数
     * @return {@link Page}<{@link LawOrderDTO}>
     */
    Page<LawOrderDTO> myPage(Page<LawOrderDTO> toPage, LawOrderDTO lawOrderDTO);

    /**
     * 查询订单
     *
     * @param orderNum 订单num
     * @return {@link Map}<{@link String},{@link Object}>
     */
    Map<String, Object> queryOrders(String orderNum);

    Map<String, Object> queryFileOrders(String orderNum);

    /**
     * 变化比例
     *
     * @param id    id
     * @param ratio 比
     */
    void changeRatio(Long id, Integer ratio);

    /**
     * 关闭订单
     *
     * @param id id
     */
    void closeOrder(Long id);

    /**
     * 支付订单
     *
     * @param orderId 订单id
     * @return {@link WechatResponseEntity}<{@link ObjectNode}>
     */
    WechatResponseEntity<ObjectNode> payOrder(Long orderId);

    /**
     * 生成文件订单
     *
     * @param price 价格
     * @return {@link Map}<{@link String},{@link Object}>
     */
    Map<String, Object> generateFileOrder(BigDecimal price);
}
